package cn.wolfcode.shop.cloud.mq;

import cn.wolfcode.shop.cloud.service.ISeckillService;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        topic = MQCounts.CREATE_ORDER,
        consumerGroup = MQCounts.ORDER_BROUND_GROUP,
        selectorExpression = MQCounts.ORDER_BROUND_TAG,
        messageModel = MessageModel.BROADCASTING
)
public class MQCreateBroundListener implements RocketMQListener<Long> {
    @Autowired
    private ISeckillService seckillService;
    @Override
    public void onMessage(Long aLong) {
        System.out.println("广播队列");
        //修改本地标识
        seckillService.updateFlag(aLong);
    }
}
